#pragma once

#include <cmath>

namespace davmath { class vec4f; }
using namespace davmath;

/* * * * * * * * * *
 * vec4f
 * Author:	David Ogle
 * Date:	26/03/2012
 * 4D Vector of float values
 * * * * * * * * * */

class davmath::vec4f
{
public:

	// Data union
	// Can access the vector components 
	// via array, or member notation
	union {
		float i[4];
		struct { float x, y, z, w; };
		struct { float r, g, b, a; };
	};



	// Constructors
	vec4f(void) { toZero(); };
	vec4f(float x, float y, float z, float w) {
		this->x = x;
		this->y = y;
		this->z = z;
		this->w = w;
	};

	// Destructor
	~vec4f(void) {	};



	void			toZero();									// zero vector
	vec4f			inverse()						const;		// inverse
	float			lengthSquared()					const;		// length-squared
	float			length()						const;		// length. Vector magnitude

	static vec4f	dot(const vec4f &a, const vec4f &b);		// dot product

	inline vec4f	operator-()	const;							// inverse
	inline bool		operator==(const vec4f &src)	const;		// equals
	inline bool		operator!=(const vec4f &src)	const;		// not-equals
	inline vec4f	operator-(const vec4f &src)		const;		// vector subtraction
	inline vec4f	operator+(const vec4f &src)		const;		// vector addition
	inline vec4f	operator*(const vec4f &src)		const;		// vector multiplication
	inline vec4f	operator/(const vec4f &src)		const;		// vector division
	inline void		operator+=(const vec4f &src);				// add-equals
	inline void		operator-=(const vec4f &src);				// subtract-equals
	inline void		operator*=(const vec4f &src);				// multiply-equals
	inline void		operator/=(const vec4f &src);				// divide-equals

	inline vec4f	operator+(const float a)		const;		// scalar addition
	inline vec4f	operator-(const float a)		const;		// scalar subtraction
	inline vec4f	operator*(const float a)		const;		// scalar multiply
	inline vec4f	operator/(const float a)		const;		// scalar divide


};

